import java.util.Random;
import java.util.Scanner;
public class Audience3 {

    public static void addAudience(String[] audience) {
        Scanner sc = new Scanner(System.in);
        for (int i = 0; i < audience.length; i++) {
            System.out.println("储存第" + (i + 1) + "个姓名：");
            audience[i] = sc.next();
        }
    }

    public static void printAudience(String[] audience) {
        for (int i = 0; i < audience.length; i++) {
            String name = audience[i];
            System.out.println("第" + (i + 1) + "观众姓名：" + name);
        }
    }

    public static String randomAudience(String[] audience) {
        int index = new Random().nextInt(audience.length);
        String name = audience[index];
        return name;
    }

    public static void main(String[] args) {
        System.out.println("-------抽取幸运观众-------");
        String[] audience = new String[3];
        addAudience(audience);
        printAudience(audience);
        String randomName = randomAudience(audience);
        System.out.println("随机抽取的幸运观众是：" + randomName);
    }
}
